import java.util.Scanner;

public class Text {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int year = scanner.nextInt();
        int month = scanner.nextInt();
        int day = scanner.nextInt();
        isDays(year,month,day);
    }
    public static void isDays(int year,int month,int day){
        int[] array1 = {31,28,31,30,31,30,31,31,30,31,30,31};
        int[] array2 = {31,29,31,30,31,30,31,31,30,31,30,31};
        int days = 0;
        if(year%400==0 || (year%4==0 && year%100!=0)){
            for (int i = 0; i < month-1; i++) {
                days += array2[i];
            }
            days += day;
            System.out.println(year+"年"+month+"月"+day+"日 是该年的第"+days+"天");
        }else{
            for (int i = 0; i < month-1; i++) {
                days += array1[i];
            }
            days += day;
            System.out.println(year+"年"+month+"月"+day+"日 是该年的第"+days+"天");
        }
    }

    /*public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String tmp = scanner.nextLine();
        char letter = tmp.charAt(0);
        if(Character.isLowerCase(letter)){
            System.out.println(Character.toUpperCase(letter));
        }else{
            System.out.println(letter);
        }
    }*/
}
